Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android chromium-130 changes #86

Merged
merged 6 commits into from
Nov 10, 2024
Merged

android chromium-130 changes #86

merged 6 commits into from
Nov 10, 2024

Conversation

Nikhil7174
Copy link
Collaborator

No description provided.

@@ -372,7 +372,8 @@ public void run() {

private void setNtpRecyclerView(LinearLayoutManager linearLayoutManager) {
mIsTopSitesEnabled = NtpUtil.shouldDisplayTopSites();
mIsBraveStatsEnabled = NtpUtil.shouldDisplayBraveStats();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return false from inside this function instead. we wouldn't have to make changes at multiple places then

@@ -85,21 +85,21 @@ protected void onFinishInflate() {
// any shortcut causes the UrlBar to be focused. See ViewRootImpl.leaveTouchMode().
mScrollView.setDescendantFocusability(FOCUS_BEFORE_DESCENDANTS);

mVpnCta = findViewById(R.id.tv_try_vpn);
if (BraveVpnUtils.isVpnFeatureSupported(getContext())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we just added a false in this If block then then else block would have hidden this as well? and the number of changes would become minimum which reduces the chances of conflicts later on

.readBoolean(BackgroundImagesPreferences.PREF_SHOW_BRAVE_STATS, true);
// return ChromeSharedPreferences.getInstance()
// .readBoolean(BackgroundImagesPreferences.PREF_SHOW_BRAVE_STATS, true);
return false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are already returning false here so changes in other files where this is being used is not needed

@@ -23,8 +23,9 @@ public static void setDisplayTopSites(boolean shouldDisplayTopSites) {
}

public static boolean shouldDisplayBraveStats() {
return ChromeSharedPreferences.getInstance()
.readBoolean(BackgroundImagesPreferences.PREF_SHOW_BRAVE_STATS, true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changing true to false here would also set this preference as false and thus would return false? and we wouldn't need to comment the whole line. minimizing changes done in existing brave code is important because it will help speed up syncing with latest brave branch in future

Copy link
Collaborator Author

@Nikhil7174 Nikhil7174 Nov 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here func will first check what value does BackgroundImagesPreferences.PREF_SHOW_BRAVE_STATS returns if it returns true then func will return true, if false then func will return false and if the value does not exists then it will return true by default. So a possibility of returning true will still remain even if default value is set to false.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this default preference is not set anywhere else then it is being set from here. If we make this false by default then it'll return false the first time and since we have hidden all other options to change this preference therefore preference will never change to true

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@@ -43,7 +43,7 @@
app:layout_constraintGuide_end="32dp" />

<!-- Keep the ID below as it's been tested in Chromium code by IncognitoNewTabPageStation. -->
<ImageView
<!-- <ImageView
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if we set a property here hiding these views. we won't have to comment the whole block of code then

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will have to set the visibility none, ht, wd , padding, margin = 0. to keep the ui aligned

@Nikhil7174 Nikhil7174 merged commit 5c7c61e into chrome-130 Nov 10, 2024
1 of 2 checks passed
@Nikhil7174 Nikhil7174 deleted the nikhil/chrome-130 branch November 10, 2024 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants